<?php

//多行文本框
function textarea($field, $value, $fieldinfo) {
    extract($fieldinfo);
    $setting = unserialize($setting);
    extract($setting);
    if (!$value)
        $value = $defaultvalue;
    $allow_empty = 'empty:true,';
    if ($minlength || $pattern)
        $allow_empty = '';
    //如果有设置错误提示，则显示表单验证
    if ($errortips){
        $this->formValidator .= '
            $("#' . $field . '").formValidator({
            ' . $allow_empty . '
                onshow:"' . $errortips . '",
                onfocus:"' . $errortips . '"
             }).inputValidator({
                min:'.$minlength.',
                max:'.$maxlength.',
                onerror:"'.$name.'长度必须在'.$minlength.'-'.$maxlength.'之间，请确认"
             });
        ';
    }
    //如果内容为空，着使用默认值
    $value = empty($value) ? $setting['defaultvalue'] : $value;
    $str = "<textarea name='info[{$field}]' id='$field' style='width:{$width}%;height:{$height}px;' $formattribute $css";
    if ($maxlength)
        $str .= " onkeyup=\"strlen_verify(this, '{$field}_len', {$maxlength})\"";
    $str .= ">{$value}</textarea>";
    if ($maxlength)
        $str .= '还可以输入<B><span id="' . $field . '_len">' . $maxlength . '</span></B>个字符！ ';

    return $str;
}

?>